package cate.game.train.favorability.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import cate.game.res.MixRes;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "提升好感度的请求")
@OperationSetter(GDOperation.FAVORABILITY_IMPROVE)
public class ImproveFavorabilityReq implements MsgInput {
    @NoteField("英雄uid")
    public String heroUid;

    @NoteField("好感度物品")
    public MixRes favorabilityItems;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.favorability.improveFavorability(cc.getRole(), heroUid, favorabilityItems);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.IMPROVE_FAVORABILITY_REQ;
    }
}
